/**
 * vim TestClass.class
 * :%!xxd
 * 十六进制文件如下:
 *
 * 00000000: cafe babe 0000 0037 0013 0a00 0400 0f09  .......7........
 * 00000010: 0003 0010 0700 1107 0012 0100 016d 0100  .............m..
 * 00000020: 0149 0100 063c 696e 6974 3e01 0003 2829  .I...<init>...()
 * 00000030: 5601 0004 436f 6465 0100 0f4c 696e 654e  V...Code...LineN
 * 00000040: 756d 6265 7254 6162 6c65 0100 0369 6e63  umberTable...inc
 * 00000050: 0100 0328 2949 0100 0a53 6f75 7263 6546  ...()I...SourceF
 * 00000060: 696c 6501 000e 5465 7374 436c 6173 732e  ile...TestClass.
 * 00000070: 6a61 7661 0c00 0700 080c 0005 0006 0100  java............
 * 00000080: 0954 6573 7443 6c61 7373 0100 106a 6176  .TestClass...jav
 * 00000090: 612f 6c61 6e67 2f4f 626a 6563 7400 2100  a/lang/Object.!.
 * 000000a0: 0300 0400 0000 0100 0100 0500 0600 0000  ................
 * 000000b0: 0200 0100 0700 0800 0100 0900 0000 1d00  ................
 * 000000c0: 0100 0100 0000 052a b700 01b1 0000 0001  .......*........
 * 000000d0: 000a 0000 0006 0001 0000 0001 0002 000b  ................
 * 000000e0: 000c 0001 0009 0000 001f 0002 0001 0000  ................
 * 000000f0: 0007 2ab4 0002 0460 ac00 0000 0100 0a00  ..*....`........
 * 00000100: 0000 0600 0100 0000 0600 0100 0d00 0000  ................
 * 00000110: 0200 0e0a                                ....
 *
 *
 * 用javap翻译上面的十六进制：
 *
 *  * ┌────────────────────┬────────────────────┬────────────────────┐
 *  * │                    │                    │                    │
 *  * │  type              │  name              │ desc               │
 *  * ├────────────────────┼────────────────────┼────────────────────┤
 *  * │                    │                    │                    │
 *  * │  u2                │  access_flats      │ public/private..   │
 *  * ├────────────────────┼────────────────────┼────────────────────┤
 *  * │                    │                    │                    │
 *  * │                    │  name_index        │  field/method name │
 *  * ├────────────────────┼────────────────────┼────────────────────┤
 *  * │                    │                    │                    │
 *  * │                    │  descriptor_index  │ (Ljava/lang/String;│
 *  * ├────────────────────┼────────────────────┼────────────────────┤
 *  * │                    │                    │                    │
 *  * │                    │  attribute_count   │                    │
 *  * ├────────────────────┼────────────────────┼────────────────────┤
 *  * │                    │                    │ ConstantValue      │
 *  * │                    │  attributes        │ Code.....          │
 *  * └────────────────────┴────────────────────┴────────────────────┘
 *
 * javap -verbose TestClass
 *
 *
 * Classfile /Users/mike/workspace/git/knowledge/深入拆解java虚拟机/classFile/src/main/java/TestClass.class
 *   Last modified Aug 30, 2019; size 559 bytes
 *   MD5 checksum 81e9cbc087ab941af8154131bace3d5d
 *   Compiled from "TestClass.java"
 * public class TestClass
 *   minor version: 0
 *   major version: 55
 *   flags: (0x0021) ACC_PUBLIC, ACC_SUPER
 *   this_class: #9                          // TestClass
 *   super_class: #10                        // java/lang/Object
 *   interfaces: 0, fields: 4, methods: 3, attributes: 1
 * Constant pool:
 *    #1 = Methodref          #10.#28        // java/lang/Object."<init>":()V
 *    #2 = String             #29            // 123
 *    #3 = Fieldref           #9.#30         // TestClass.a:Ljava/lang/String;
 *    #4 = String             #31            // 345
 *    #5 = Fieldref           #9.#32         // TestClass.c:Ljava/lang/String;
 *    #6 = String             #33            // 234
 *    #7 = Fieldref           #9.#34         // TestClass.b:Ljava/lang/String;
 *    #8 = Fieldref           #9.#35         // TestClass.m:I
 *    #9 = Class              #36            // TestClass
 *   #10 = Class              #37            // java/lang/Object
 *   #11 = Utf8               m
 *   #12 = Utf8               I
 *   #13 = Utf8               a
 *   #14 = Utf8               Ljava/lang/String;
 *   #15 = Utf8               ConstantValue
 *   #16 = Utf8               c
 *   #17 = Utf8               b
 *   #18 = Utf8               <init>
 *   #19 = Utf8               ()V
 *   #20 = Utf8               Code
 *   #21 = Utf8               LineNumberTable
 *   #22 = Utf8               inc
 *   #23 = Utf8               (Ljava/lang/String;)[[I
 *   #24 = Utf8               inc2
 *   #25 = Utf8               (LTest2;)LTest2;
 *   #26 = Utf8               SourceFile
 *   #27 = Utf8               TestClass.java
 *   #28 = NameAndType        #18:#19        // "<init>":()V
 *   #29 = Utf8               123
 *   #30 = NameAndType        #13:#14        // a:Ljava/lang/String;
 *   #31 = Utf8               345
 *   #32 = NameAndType        #16:#14        // c:Ljava/lang/String;
 *   #33 = Utf8               234
 *   #34 = NameAndType        #17:#14        // b:Ljava/lang/String;
 *   #35 = NameAndType        #11:#12        // m:I
 *   #36 = Utf8               TestClass
 *   #37 = Utf8               java/lang/Object
 * {
 *   public int m;
 *     descriptor: I
 *     flags: (0x0001) ACC_PUBLIC
 *
 *   public final java.lang.String a;
 *     descriptor: Ljava/lang/String;
 *     flags: (0x0011) ACC_PUBLIC, ACC_FINAL
 *     ConstantValue: String 123
 *
 *   public java.lang.String c;
 *     descriptor: Ljava/lang/String;
 *     flags: (0x0001) ACC_PUBLIC
 *
 *   public TestClass();
 *     descriptor: ()V
 *     flags: (0x0001) ACC_PUBLIC
 *     Code:
 *       stack=2, locals=1, args_size=1
 *          0: aload_0
 *          1: invokespecial #1                  // Method java/lang/Object."<init>":()V
 *          4: aload_0
 *          5: ldc           #2                  // String 123
 *          7: putfield      #3                  // Field a:Ljava/lang/String;
 *         10: aload_0
 *         11: ldc           #4                  // String 345
 *         13: putfield      #5                  // Field c:Ljava/lang/String;
 *         16: aload_0
 *         17: ldc           #6                  // String 234
 *         19: putfield      #7                  // Field b:Ljava/lang/String;
 *         22: return
 *       LineNumberTable:
 *         line 264: 0
 *         line 267: 4
 *         line 268: 10
 *         line 269: 16
 *
 *   public static int[][] inc(java.lang.String);
 *     descriptor: (Ljava/lang/String;)[[I
 *     flags: (0x0009) ACC_PUBLIC, ACC_STATIC
 *     Code:
 *       stack=1, locals=1, args_size=1
 *          0: aconst_null
 *          1: areturn
 *       LineNumberTable:
 *         line 271: 0
 *
 *   public Test2 inc2(Test2);
 *     descriptor: (LTest2;)LTest2;         //LTest2表示是一个引用
 *     flags: (0x0001) ACC_PUBLIC
 *     Code:
 *       stack=3, locals=3, args_size=2
 *          0: iconst_2
 *          1: istore_2
 *          2: iinc          2, 1
 *          5: aload_0
 *          6: aload_0
 *          7: getfield      #8                  // Field m:I
 *         10: iconst_1
 *         11: iadd
 *         12: putfield      #8                  // Field m:I
 *         15: aconst_null
 *         16: areturn
 *       LineNumberTable:
 *         line 274: 0
 *         line 275: 2
 *         line 276: 5
 *         line 277: 15
 * }
 * SourceFile: "TestClass.java"
 */
public class TestClass {

    public int m;
    public final String a = "123";
    public String c = "345";
    private final String b = "234";
    public static int[][] inc(String a) {
        return null;
    }
    public Test2 inc2(Test2 test2){
        int n = 2;
        n++;
        m=m+1;
        return null;
    }
}


